package com.emcom.gotour.mvc.view;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import com.emcom.gotour.enums.TourType;
import com.emcom.gotour.po.TourCategory;
import com.emcom.gotour.vo.TourTypeVO;

import org.apache.commons.lang.builder.CompareToBuilder;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

public class CategoryView implements Comparable<Object>, Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 3112146016091557757L;
	private String title;
	private List<TourCategory> categoryList;
	private NavigationView navigationView;
	private CategoryContentView categoryContentView;
	private GlobalView globalView;
	private List<TourTypeVO> tourTypeList;
	public List<TourTypeVO> getTourTypeList() {
		TourType[] tourTypes = TourType.values();
		List<TourTypeVO> tourTypeVOList = new ArrayList<TourTypeVO>();
		for(TourType tourType : tourTypes) {
			TourTypeVO tourTypeVO = new TourTypeVO();
			tourTypeVO.setId(tourType.name());
			tourTypeVO.setName(tourType.value());
			tourTypeVOList.add(tourTypeVO);
		}
		return tourTypeVOList;
	}
	public void setTourTypeList(List<TourTypeVO> tourTypeList) {
		this.tourTypeList = tourTypeList;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public List<TourCategory> getCategoryList() {
		return categoryList;
	}
	public void setCategoryList(List<TourCategory> categoryList) {
		this.categoryList = categoryList;
	}
	public NavigationView getNavigationView() {
		return navigationView;
	}
	public void setNavigationView(NavigationView navigationView) {
		this.navigationView = navigationView;
	}
	public CategoryContentView getCategoryContentView() {
		return categoryContentView;
	}
	public void setCategoryContentView(CategoryContentView categoryContentView) {
		this.categoryContentView = categoryContentView;
	}
	public GlobalView getGlobalView() {
		return globalView;
	}
	public void setGlobalView(GlobalView globalView) {
		this.globalView = globalView;
	}
	/**
	 * @see java.lang.Comparable#compareTo(Object)
	 */
	public int compareTo(Object object) {
		CategoryView myClass = (CategoryView) object;
		return new CompareToBuilder().append(this.title, myClass.title).append(
				this.categoryContentView, myClass.categoryContentView).append(
				this.categoryList, myClass.categoryList).append(
				this.tourTypeList, myClass.tourTypeList).append(
				this.globalView, myClass.globalView).append(
				this.navigationView, myClass.navigationView).toComparison();
	}
	/**
	 * @see java.lang.Object#equals(Object)
	 */
	public boolean equals(Object object) {
		if (!(object instanceof CategoryView)) {
			return false;
		}
		CategoryView rhs = (CategoryView) object;
		return new EqualsBuilder().appendSuper(super.equals(object)).append(
				this.title, rhs.title).append(this.categoryContentView,
				rhs.categoryContentView).append(this.categoryList,
				rhs.categoryList).append(this.tourTypeList, rhs.tourTypeList)
				.append(this.globalView, rhs.globalView).append(
						this.navigationView, rhs.navigationView).isEquals();
	}
	/**
	 * @see java.lang.Object#hashCode()
	 */
	public int hashCode() {
		return new HashCodeBuilder(-1759587063, 1981413787).appendSuper(
				super.hashCode()).append(this.title).append(
				this.categoryContentView).append(this.categoryList).append(
				this.tourTypeList).append(this.globalView).append(
				this.navigationView).toHashCode();
	}
	/**
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
		return new ToStringBuilder(this).append("globalView", this.globalView)
				.append("tourTypeList", this.tourTypeList).append(
						"navigationView", this.navigationView).append(
						"categoryContentView", this.categoryContentView)
				.append("title", this.title).append("categoryList",
						this.categoryList).toString();
	}
}
